package com.example.taluo.logic;

import com.example.taluo.entity.dto.gamedto.Card;
import com.example.taluo.entity.dto.gamedto.PlayerState;

import java.util.ArrayList;
import java.util.List;

/*** @Author supersaiya
 * @Description 抽卡逻辑

 * @Date 2025/2/18 17:04

 * @Version 1.0*/
public class CardManager {
    public  CardEffectProcessor cardEffectProcessor;
    public static void drawCards(PlayerState player, int numCards) {
        for (int i = 0; i < numCards; i++) {
            if (!player.getDeck().isEmpty()) {
                player.getHand().add(player.getDeck().remove(0)); // 从牌库顶部抽牌
            }
        }
    }
    public List<Card> initializeDeck() {
        List<Card> deck = new ArrayList<>();
        deck.add(new Card(1, "Fireball", 5));
        deck.add(new Card(2, "Heal", -3));
        deck.add(new Card(3, "ConsecutiveWin", 0));
        return deck;
    }

    public void applyCardEffects(Card card, PlayerState player, PlayerState opponent) {
        switch (card.getName()) {
            case "Fireball":
                opponent.setLife(opponent.getLife() - card.getDamage());
                break;
            case "Heal":
                opponent.setLife(opponent.getLife() + card.getDamage());
                break;
            // 其他卡牌效果
            default:
                System.out.println("Unknown card effect: " + card.getName());
        }
    }
}